package org.easy.socket.server;

import com.alibaba.fastjson.JSONObject;
import org.smartboot.socket.StateMachineEnum;

/**
 * @Description: 客户端连接服务端成功后，服务端向客户端发送数据格式
 * @Author: wxl
 * @CreateTime: 2023/1/12 10:10
 */
public class DataModel {

    private StateMachineEnum state;

    /**
     * 客户端ID
     */
    private String clientId;
    /**
     * 发送的数据，为JSON字符串
     */
    private String data;

    public DataModel() {}

    public DataModel(String clientId) {
        this();
        this.clientId = clientId;
    }

    public DataModel(String clientId, String data) {
        this(clientId);
        this.data = data;
    }

    public DataModel(String clientId, JSONObject object) {
        this(clientId, object.toJSONString());
    }

    public StateMachineEnum getState() {
        return state;
    }

    public void setState(StateMachineEnum state) {
        this.state = state;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
